package com.dg.properties

class PropertyUtility {

	static def grailsApplication

	static String getProjectPath(String aProjectGroupName, String aProjectName) {
		String projectPath = grailsApplication.config.project.path
		
		String projectGroupSub = grailsApplication.config.project.group.substitution
		String projectSub = grailsApplication.config.project.substitution
		
		projectPath = projectPath.replaceAll(projectGroupSub, aProjectGroupName)
		projectPath = projectPath.replaceAll(projectSub, aProjectName)
		
		return projectPath
	}
	
	static String getProjectImagePath(String aProjectGroupName, String aProjectName) {
		String projectPath = grailsApplication.config.project.images.path
		
		String projectGroupSub = grailsApplication.config.project.group.substitution
		String projectSub = grailsApplication.config.project.substitution
		
		projectPath = projectPath.replaceAll(projectGroupSub, aProjectGroupName)
		projectPath = projectPath.replaceAll(projectSub, aProjectName)
		
		return projectPath
	}
}
